// 模块的 store
export default {
  namespaced: true,
  state: {
    count: 0,
    xxx: '这里的数据只存储在 vuex 中, 并没有缓存到 localStorage',
  },
  mutations: {
    setCount: (state, data) => { state.count = data; },
  },
  actions: {
    async setCountActions({ commit, rootState }, data) {
      console.log('这里可以获取到根的 state :>> ', rootState);
      return new Promise((resolve) => {
        setTimeout(() => {
          commit('setCount', data);
          resolve();
        }, 1000);
      });
    },
  },
  getters: {},
};
